The DoS module¶
This module is used to display the Density of States (DoS).
The Main Class of this module is
such class interpret the information coming from a set of energies and
represents in this way a curve that smears such energies.
- class DiracSuperposition(dos, wgts=[1.0])¶
Sum of weighted Dirac deltas.
Defines a superposition of Dirac deltas which can be used to plot the density of states. Such deltas are given on a per k-point basis and can be also equipped with a array of weights, which may be useful to define Partial Density of States.
dos (matrix) – array containing the density of states per each k-point. Should be of shape 2, a list of energies per kpoint
wgts (float, array, matrix) – contains the weights of each of the k-points. Could be a constant, in which case the same weight is applied everywhere, a list (on a k-point basis), or a matrix, where each energy have its own weight.
- curve(xs, sigma, wgts=None)¶
Output the quantities to be plotted.
Returns the x,y arrays that can be passed to plotting programs to represent the DoS.
- peak(omega, e, sigma)¶
Define if a peak is a Gaussian or a Lorenzian (temporarily only the gaussian is defined)
- peaks(xs, dos, norms, sigma)¶
Return the array of the whole set of peaks
- class DoS(bandarrays=None, energies=None, evals=None, logfiles_dict=None, units='eV', reference_fermi_level=None, label='1', sigma=0.2, fermi_level=None, norm=1.0, sdos=None, **kwargs)¶
Density of states class.
Extract a quantity which is associated to the DoS, that can be plotted
energies (array-like) – a list of energies to be plotted. Useful for plotting a single DoS from an array.
reference_fermi_level (float) – useful in the case of a logfiles_dict. the value of the reference fermi level is compared with the fermi level of all the logfiles in order to align all the curves. It is assumed that the fermi levels are properly defined in all the logfiles.
units (str) – The units of the provided energies, and fermi_level. Should be AU of eV.
label (str) – label of the curve.
sigma (float) – smearing of the energies. Always provided in eV.
fermi_level (float) – set the value of the fermi energy.
sdos – spatial density of states instantiation
**kwargs – keyword arguments of the
- append(energies, label=None, units='eV', norm=1.0)¶
Include other DoS inside the instance.
- append_from_bandarray(bandarrays, label)¶
Add a new band array to the previous DoS.
This method can be called to include in the DoS the energies which come from another run.
- append_from_dict(evals, label)¶
Get the energies from the different flavours given by the dict.
Represent the dta to be plotted as a table.
This is a commodity function that can be used to redirect the output of the DoS into a file.
- fermi_level(fermi_level, units='eV')¶
Set the fermi level of the DoS.
- get_curves(range=None, sigma=None)¶
Get the curves of the DoS instance, ready for plotting.
This function provides a dictionary of data for each of the curves which can be plots by the
plot()method. They can be retrieved also to be plotted with other plotting tools.
range (array) – the xrange to be employed for the curves. If not provided, use the
rangeattribute of the instance.
sigma (float) – the smearing of the dos. If not provided, use the
sigmaattribute of the instance.
- a dicitonary of a label: (x,y) items,
where x,y are the data to be plotted. (x,y) is a py:class:~collections.namedtuple class instance, as returned from DiracSuperposition.
- Return type
- plot(sigma=None, ax=None, smearing_slider=False)¶
Commodity Function to plot the DoS.
Plot the curves which are available.
- The axis instance used for the plot.
This is also present in the ax1 attribute of the class.
- Return type
- set_range(npts=None, e_min=None, e_max=None, deltae=None)¶
Adjust the range of the curves to be plotted/represented.
This function can be called if it is necessary to adjust the range of the curves.
Shift the curves.
Apply a constant or a per-curve shift on the data.
shift (float, list, dict) – the shift to be implemented. If it is a constant, it is performed on all the curves. If it is a list, the shif is performed on all the DoS, in appending order. Should have the same length of the labels. If is is a dict, it assumes the shift per label. Only the indicated DoS will be shifted. The units of the shift are always in eV.